<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="大赛名称" prop="skillName">
        <el-input
          v-model="queryParams.skillName"
          placeholder="请输入大赛名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报名类型" prop="type">
        <el-select v-model="queryParams.type" placeholder="请选择类型" clearable>
          <el-option
            v-for="dict in dict.type.bm_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="报名批次编号" prop="bmNo">
        <el-input
          v-model="queryParams.bmNo"
          placeholder="请输入报名批次编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="审核状态" prop="checkStatus" v-if="type=='m'">
        <el-select v-model="queryParams.checkStatus" placeholder="请选择审核状态" clearable>
          <el-option
            v-for="dict in dict.type.check_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          icon="el-icon-download"
          @click="handleExport()"
        >导出报名
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          v-if="type=='bmcheck'"
          @click="tobmdetail('1')"
        >个人报名
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          v-if="type=='bmcheck'"
          @click="tobmdetail('2')"
        >团队报名
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          v-if="type=='score'  ||  type=='pf' ||  type=='cert'  "
          icon="el-icon-download"
          @click="exportScore()"
        >导出成绩
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleBmImport"
          v-if="type=='bmcheck'"
        >批量报名
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-if=" type=='pf'"
        >导入成绩
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          @click="createRankNo"
          v-if="type=='pf'"
        >生成排名
        </el-button>
      </el-col>

      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="bmList" @selection-change="handleSelectionChange">
      <el-table-column label="序号" type="index" width="60" header-align="center" align="center"></el-table-column>
      <!--      <el-table-column type="selection" width="55" align="center" />-->
      <!--      <el-table-column label="主键" align="center" prop="id" />-->
      <!--      <el-table-column label="大赛Id" align="center" prop="skillId" />-->
      <el-table-column label="大赛名称" align="center" prop="skillName"  show-overflow-tooltip/>
      <el-table-column label="报名类型" align="center" prop="type">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.bm_type" :value="scope.row.type"/>
        </template>
      </el-table-column>
      <el-table-column label="报名批次编号" align="center" prop="bmNo"  show-overflow-tooltip/>
      <el-table-column label="指导老师" align="center" prop="teacherName" show-overflow-tooltip/>
      <el-table-column label="成绩" align="center" prop="score"  v-if="type=='score' ||  type=='pf'  ||  type=='cert' "/>
      <el-table-column label="排名" align="center" prop="rankNo" v-if="type=='score' ||  type=='pf' ||  type=='cert'"/>
      <el-table-column label="获奖等级" align="center" prop="levelType"  v-if="type=='score' ||  type=='pf' ||  type=='cert'">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.award_level" :value="scope.row.levelType"/>
        </template>
      </el-table-column>
      <el-table-column label="证书编号" align="center" prop="certNo" v-if="type=='score' ||  type=='pf'  ||  type=='cert' "/>
      <el-table-column label="证书时间" align="center" prop="certTime" v-if="type=='score' ||  type=='pf'  ||  type=='cert' ">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.certTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核状态" align="center" prop="checkStatus" v-if="type=='bmcheck'">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.check_status" :value="scope.row.checkStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="报名账号" align="center" prop="createNickName"/>
      <el-table-column label="报名时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核时间" align="center" prop="checkDate" width="180"  v-if="type=='bmcheck'">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.checkDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核备注" align="center" prop="checkRemark"  v-if="type=='bmcheck'"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="bMdetail(scope.row)"
          >报名信息
          </el-button>
          <el-button
            size="mini"
            type="text"
            @click="generateCertificate(scope.row)"
            v-if="(type=='score'  ||  type=='pf' ||  type=='cert' )   &&  scope.row.certNo "
          >查看证书
          </el-button>
          <el-button
            size="mini"
            type="text"
            @click="downloadCertificate(scope.row)"
            v-if="(type=='score'  ||  type=='pf' ||  type=='cert' )  &&  scope.row.certNo"
          >下载证书
          </el-button>


          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="updateScoredetail(scope.row)"
            v-if="type=='pf'"
          >成绩输入
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            v-if="type=='bmcheck'"
            @click="checkUpdate(scope.row)"
          >审核
          </el-button>
          <!--          <el-button-->
          <!--            size="mini"-->
          <!--            type="text"-->
          <!--            icon="el-icon-delete"-->
          <!--            v-if="type=='m'"-->
          <!--            @click="handleDelete(scope.row)"-->
          <!--            v-hasPermi="['system:bm:remove']"-->
          <!--          >删除</el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改大赛申报对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="成绩" prop="score">
          <el-input-number v-model="form.score" placeholder="请输入成绩" :min="1"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="title" :visible.sync="checkopen" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="checkrules" label-width="120px">
        <el-form-item label="审核" prop="checkStatus">
          <el-select v-model="form.checkStatus" style="width: 196.4px" placeholder="审核是否通过" clearable>
            <el-option label="通过" value="2"/>
            <el-option label="不通过" value="3"/>
          </el-select>
        </el-form-item>
        <div class="itemcol textarea">
          <el-form-item label="审核意见">
            <el-input v-model="form.checkRemark" placeholder="审核意见" type="textarea"></el-input>
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="checkSubmitForm">确 定</el-button>
        <el-button @click="checkCancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="title" :visible.sync="openBmXx" width="1200px" append-to-body>
      <SillBmUser ref="skillbmuser" :skillBmId=skillBmId  :skillId="skillId"  @getList="getList"   :type="type" v-if="openBmXx"></SillBmUser>
    </el-dialog>

    <el-dialog :title="title" :visible.sync="tobmopen" width="800px" append-to-body>
      <el-form ref="bmformre" :model="bmform" :rules="bmrules" label-width="80px">
        <el-form-item label="姓名" prop="name">
          <el-input v-model="bmform.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="学校" prop="schoolDeptId">
          <el-select v-model="bmform.schoolDeptId" placeholder="请选择">
            <el-option
              v-for="dict in schoolList"
              :key="dict.deptId"
              :label="dict.deptName"
              :value="dict.deptId"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="院系" prop="xyDeptId">
          <el-select v-model="bmform.xyDeptId" placeholder="请选择院系">
            <el-option
              v-for="dict in yxList"
              :key="dict.deptId"
              :label="dict.deptName"
              :value="dict.deptId"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="专业类型" prop="zyType">
          <el-select v-model="bmform.zyType" placeholder="请选择专业类型">
            <el-option
              v-for="dict in dict.type.zy_type"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="学号" prop="studyNo">
          <el-input v-model="bmform.studyNo" placeholder="请输入学号" />
        </el-form-item>
        <el-form-item label="指导老师" prop="teacherName">
          <el-input v-model="bmform.teacherName" placeholder="请输入指导老师" />
        </el-form-item>
      </el-form>
      <el-form ref="formfj" label-width="120px">
        <el-form-item label="附件信息" prop="ysSm">
          <div>
            <FileUpload
              v-if="tobmopen"
              ref="expertRef"
              :disabled="true"
              :bottom-tips="'文件格式必须为\'.doc\',\'.docx\',\'.pdf\',\'.png\',文件大小不超过10M'"
              :businessId="skillBmId"
              :biz-type="'xqfj001'"
              :limit="5"
              :accept="['.doc','.docx','.pdf','.png']"
              style="margin-left: 20px"
            ></FileUpload>
          </div>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
           <el-button type="primary" @click="tobmsubmitForm">确 定</el-button>
        <el-button @click="tobmcancel">取 消</el-button>
      </div>
    </el-dialog>


    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?skillId=' +this.skillId"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
<!--          <div class="el-upload__tip" slot="tip">-->
<!--            <el-checkbox v-model="upload.updateSupport"/>-->
<!--            是否更新已经存在的用户数据-->
<!--          </div>-->
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
                   @click="importTemplate"
          >下载模板
          </el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="bmupload.title" :visible.sync="bmupload.open" width="400px" append-to-body>
      <el-upload
        ref="bmupload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="bmupload.headers"
        :action="bmupload.url + '?skillId=' +this.skillId+'&isUpdateSupport=' + bmupload.updateSupport"
        :disabled="bmupload.isUploading"
        :on-progress="bmhandleFileUploadProgress"
        :on-success="bmhandleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
            <div class="el-upload__tip" slot="tip">
                   <el-checkbox v-model="bmupload.updateSupport"/>
                  是否是个人报名
                </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
                   @click="bmimportTemplate"
          >下载模板
          </el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="bmsubmitFileForm">确 定</el-button>
        <el-button @click="bmupload.open = false">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog title="查看证书" :visible.sync="zsopen" width="550px" heigth="100%" append-to-body>
      <div style="width: 500px;height: 800px;">
        <img :src="imageUrl" alt="证书" style="width: 500px;height: 800px;">
      </div>

    </el-dialog>


  </div>
</template>

<script>
import { listBm, getBm, delBm, addBm, updateBm, check } from '@/api/business/skillbm'
import SillBmUser from '@/components/skillbmUser/index'
import { addScoreGreateNO, addWebbm } from '../../api/business/skillbm'
import { getSelectDeptlist } from '../../api/system/dept'
import { guid } from '../../utils/utils'
import FileUpload from '@/components/fileUpload_new.vue'
import { getToken } from '@/utils/auth'
import { generateCertificate,downloadCertificate } from '@/api/business/skillbm'
export default {
  name: 'SkillBm',
  components: { SillBmUser,FileUpload },
  dicts: ['check_status', 'bm_type', 'award_level','zy_type'],
  props: {
    skillId: {
      type: String,
      default: null
    },
    type: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: '',
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: 'Bearer ' + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + '/webApi/importScoreData'
      },
      bmupload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: '',
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: true,
        // 设置上传的请求头部
        headers: { Authorization: 'Bearer ' + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + '/webApi/importBmData'
      },
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      zsopen: false,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 大赛申报表格数据
      bmList: [],
      schoolList:[],
      bmuserlist:[],
      yxList:[],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      checkopen: false,
      openBmXx: false,
      tobmopen: false,
      imageUrl:"",
      skillBmId: '',
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        skillId: null,
        type: null,
        bmUserId: null,
        bmNo: null,
        checkStatus: null,
        checkDate: null,
        checkRemark: null,
        skillName: null,
        orderByType: null
      },
      // 表单参数
      form: {},
      bmform:{},
      // 表单校验
      rules: {},
      checkrules: {
        checkStatus: [
          { required: true, message: '是否通过', trigger: 'blur' }
        ]
      },
      bmrules:{


      }
    }
  },
  created() {
    this.getList()
    this.getSelectDeptlist()
    this.getSelectYxDeptlist()
  },
  methods: {
    downloadCertificate(row){
      this.$download.image("/webApi/downloadCertificate?id="+row.id,"证书")
    },
    generateCertificate(row){
      this.zsopen=true
      generateCertificate({id:row.id}).then(response => {
        this.imageUrl=response.msg;
        console.log(this.imageUrl);
        console.log(response.data);
      });
    },
    checkSubmitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          check(this.form).then(response => {
            this.$modal.msgSuccess('修改成功')
            this.checkopen = false
            this.getList()
          })
        }
      })
    },

    checkUpdate(row) {
      this.form.checkStatus = '2'
      this.form.id = row.id
      this.checkopen = true
      this.title = '审核'
    },
    /** 查询大赛申报列表 */
    getList() {
      this.loading = true
      if (this.skillId) {
        this.queryParams.skillId = this.skillId
      }
      if (this.type == 'pf' || this.type == 'score') {
        this.queryParams.checkStatus = '2'
        this.queryParams.orderByType = '1'
      }
      listBm(this.queryParams).then(response => {
        this.bmList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    getSelectDeptlist(){
      var  data={
        deptId:100
      }
      getSelectDeptlist(data).then(response => {
        this.schoolList=response.data
      })

    },
    getSelectYxDeptlist(){
      var  data={
        parentId:100
      }
      getSelectDeptlist(data).then(response => {
        this.yxList=response.data
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    checkCancel() {
      this.checkopen = false
      this.reset()
    },
    tobmcancel(){
      this.tobmopen=false

    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        skillId: null,
        type: null,
        bmUserId: null,
        bmNo: null,
        checkStatus: null,
        checkDate: null,
        createBy: null,
        checkRemark: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        delFlag: null
      }
      this.resetForm('form')
    },

    resetBm() {
      this.bmform = {
        id: null,
        skillId: this.skillId,
        skillBmId: null,
        name: null,
        bmType: null,
        schoolDeptId: null,
        xyDeptId: null,
        zyType: null,
        studyNo: null,
        source: null,
        teacherName: null,
      }
      this.resetForm('form')
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加大赛申报'
    },

    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getBm(id).then(response => {
        this.form = response.data
        this.open = true
        this.title = '修改大赛申报'
      })
    },
    updateScoredetail(row) {
      const id = row.id || this.ids
      getBm(id).then(response => {
        this.form = response.data
        this.open = true
        this.title = '录入成绩'
      })

    },
    tobmsubmitForm(){
      this.$refs['bmformre'].validate(valid => {
        if (valid) {
          this.bmuserlist.push(this.bmform)
          addWebbm(this.bmuserlist).then(response => {
            this.$modal.msgSuccess('操作成功')
            this.tobmopen = false
            this.getList()
          })
        }
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateBm(this.form).then(response => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            addBm(this.form).then(response => {
              this.$modal.msgSuccess('新增成功')
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    bMdetail(row) {
      // 报名信息查看
      this.openBmXx = true
      this.skillBmId = row.id
    },
    tobmdetail(bmtype){
      this.resetBm()
      let mizId = guid().replace(/-/g, '');
      this.skillBmId = mizId
      if(bmtype=='1'){
        // 个人报名
        this.bmform.bmType=bmtype
        this.tobmopen=true
      }else{
        // 团队报名
        this.openBmXx = true
      }



    },
    createRankNo() {
      const skillId = this.skillId
      this.$modal.confirm('是否确认生成排名和获奖信息？').then(function() {
        var data = {
          id: skillId
        }
        return addScoreGreateNO(data)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('操作成功')
      }).catch(() => {
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除大赛申报编号为"' + ids + '"的数据项？').then(function() {
        return delBm(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('business/skillBmUser/export', {
        ...this.queryParams
      }, `bm_${new Date().getTime()}.xlsx`)
    },
    exportScore(){
      this.download('business/skillBmUser/export', {
        ...this.queryParams
      }, `score_${new Date().getTime()}.xlsx`)

    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = '成绩导入'
      this.upload.open = true
    },

    handleBmImport() {
      this.bmupload.title = '成绩导入'
      this.bmupload.open = true
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('business/skillbm/importTemplate', {}, `score_template_${new Date().getTime()}.xlsx`)
    },
    bmimportTemplate() {
      this.download('business/skillbm/importTemplatebm', {}, `bm_template_${new Date().getTime()}.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true
    },
    bmhandleFileUploadProgress(event, file, fileList) {
      this.bmupload.isUploading = true
    },
    // 文件上传成功处理
    bmhandleFileSuccess(response, file, fileList) {
      if(response.code=='500'){
        this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 100vh;color:red;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
        this.bmupload.isUploading = false
        this.$refs.bmupload.clearFiles()

      }else{
        this.bmupload.open = false
        this.bmupload.isUploading = false
        this.$refs.bmupload.clearFiles()
        this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 100vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
        this.getList()
      }

    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false
      this.upload.isUploading = false
      this.$refs.upload.clearFiles()
      this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 100vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
      this.getList()
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit()
    },
    bmsubmitFileForm() {
      this.$refs.bmupload.submit()
    }
  }
}
</script>
